# coding=utf-8
# 代码文件：chapter3/ch3.2.12.py

import xlwings as xw

app = xw.App(visible=False, add_book=False)
f = r'data/学生信息 -带有宏.xlsm'

wb = app.books.open(f)

sheet1 = wb.sheets[0]

rng1 = sheet1.range('A1').current_region

run_macro = app.macro('MyModule1.Duplicates_Rows')  # 获得VBA宏对象
run_macro(rng1, 1)

f = r'data/学生信息 -删除重复数据后.xlsm'

wb.save(path=f)
wb.close()
app.quit()

print('Game Over')
